package com.pig4cloud.pigx.contract.api.v1.controller;

import com.pig4cloud.pigx.common.core.util.R;
import com.pig4cloud.pigx.common.customize.api.annotation.OpenApi;
import com.pig4cloud.pigx.contract.api.v1.service.FundingRateHistoryServiceV1;
import com.pig4cloud.pigx.contract.open.api.vo.OpenApiFundingRateHistoryVOV1;
import com.pig4cloud.pigx.user.enums.UserApiKeyEnum;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 开放API - 资金费率历史 - v1版本
 *
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/v1/contract/funding/rate/history" )
@Api(value = "api_funding_rate_history_v1", tags = "开放api-资金费率历史")
public class FundingRateHistoryControllerV1 {

	private final FundingRateHistoryServiceV1 service;

	/**
	 * 获取资金费率历史
	 * @param symbolName 币对名称
	 * @return list
	 */
	@OpenApi(version = "1",permission = UserApiKeyEnum.Permission.READ)
	@GetMapping("/list")
	public R<List<OpenApiFundingRateHistoryVOV1>> getList(@RequestParam("symbolName") String symbolName) {
		return service.getList(symbolName);
	}

}
